module.exports = {
  mode: 'universal',
  /*
  ** Headers of the page
  */
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      {charset: 'utf-8'},
      {name: 'viewport', content: 'width=device-width, initial-scale=1'},
      {hid: 'description', name: 'description', content: process.env.npm_package_description || ''}
    ],
    link: [
      {rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'}
    ]
  },
  /*
  ** Customize the progress-bar color
  */
  loading: {color: '#fff'},
  /*
  ** Global CSS
  */
  css: [
    {src: '../assets/reset.css'},
    {src: 'swiper/dist/css/swiper.css'},
  ],
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    {src: '@/plugins/poly', ssr: true},
    '@/plugins/axios',
    '@/plugins/common',
    { src: '@/plugins/swiper-plugin.js', ssr: false },

  ],
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [],
  /*
  ** Nuxt.js modules
  */
  modules: [
    '@nuxtjs/axios',
  ],
  axios: {
    proxy: true,
    prefix: '/api', // baseURL
    credentials: true,
  },
  proxy: {
    '/api': {
      target: 'https://evp.51job.com/51job/api/51microadmin', // 代理地址
      changeOrigin: true,
      pathRewrite: {
        '^/api': '', //将 /api 替换掉
      },
    },
  },
  // 环境变量
  env: {
    baseUrl: process.env.BASE_URL,
    nodeEnv: process.env.NODE_ENV
  },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    publicPath: '/fast2/client/',
    extend(config, ctx) {
    },
    postcss: {
      // 添加插件名称作为键，参数作为值
      // 使用npm或yarn安装它们
      plugins: {
        // 通过传递 false 来禁用插件
        'postcss-nested': {},
        'postcss-responsive-type': {},
        'postcss-hexrgba': {},
        // "autoprefixer": {},
        "postcss-px-to-viewport": {
          // 需要转换的单位，默认为"px"
          unitToConvert: 'rem',
          // 设计稿的视口宽度, 将根据视口做比例换算
          viewportWidth: 7.5,
          // 转化精度，转换后保留位数
          unitPrecision: 3,
          // 希望使用的视口单位
          viewportUnit: 'vw',
          // 字体使用的视口单位
          fontViewportUnit: 'vw',
          // 需要忽略的CSS选择器
          selectorBlackList: [],
          // 最小的转换数值
          minPixelValue: 1,
          // 媒体查询里的单位是否需要转换单位
          mediaQuery: true,
          // 忽略文件目录
          exclude: /([\/\\])(node_modules)([\/\\])/,
        }
      },
      preset: {
        // 更改postcss-preset-env 设置
        autoprefixer: {}
      }
    },
    babel: {
      "presets": [
        [
          "@babel/preset-env",
          {
            "targets": {
              "chrome": "58",
              "ie": "10"
            }
          },
        ]
      ],
      plugins: ['@babel/plugin-transform-runtime']
    }
  }
};
